﻿CREATE proc [dbo].[proc_CheckInOut_Out]
(
	@CustomerId nvarchar(50),
	@ContactPerson nvarchar (20),
	@ContactTel nvarchar(20),
	@Address nvarchar(500),
	@MainProjectId int,
	@Aim nvarchar(50),
	@Content nvarchar(500),
	@Accompany nvarchar(50),
	@UserName nvarchar(20),
	@CheckOutTime datetime
)
as
begin
--公司Id
declare @companyid int
set @companyid = (select Companyid from aspnet_Users where username=@username)

declare @DepartmentId int
set @DepartmentId = (select DepartmentId from Employee where Username=@Username)


	insert into CheckInOut
	(
	CompanyId,
	CustomerId,
	ContactPerson,
	ContactTel,
	Address,
	MainProjectId,
	Aim,
	Content,
	Accompany,
	UserName,
	CheckOutTime,
	DepartmentId
	)
    values
    (
    @companyid,
    @CustomerId,
    @ContactPerson,
    @ContactTel,
    @Address,
    @MainProjectId,
    @Aim,
    @Content,
    @Accompany,
    @UserName,
    @CheckOutTime,
    @DepartmentId
    )

   return 1 
end


